package dp;

/**
 * @Author: wangliuyang
 * @Date: 2021/6/11 15:44
 * @Description: 300. 最长递增子序列
 */
public class LengthOfLIS {
        public int lengthOfLIS(int[] nums) {
            int max = 1;
            int[] dp = new int[nums.length];
            dp[0] = 1;
            for (int i = 1; i < dp.length; i++) {
                dp[i] = 1;
                for (int j = 0; j < i; j++) {
                    if (nums[i] > nums[j]){
                        dp[i] = Math.max(dp[i],dp[j] + 1);
                    }
                }
                max = Math.max(max,dp[i]);
            }
            return max;
        }
}
